#include "page_helper.h"
#include "ui_mainwindow.h"

void apply_page(Ui::MainWindow *ui, int pageId)
{
    if (!ui) return;

    if (pageId < 0 || pageId >= PAGE_COUNT)
        pageId = PAGE_PREVIEW;

    const PageInfo &info = g_pageTable[pageId];

    ui->stackedWidget->setCurrentIndex(info.stackedIndex);

    if (ui->lblPageTitle)
        ui->lblPageTitle->setText(info.title);
}
